﻿using System;
using System.Collections.Generic;
using System.Text;

using ET;
using Marx;
using Marx.EventType;

namespace Server
{
    [Event]
    public class AppReadyHandler : AEvent<Marx.EventType.AppReady>
    {
        protected override void Run(AppReady a)
        {
            int currentId = StartConfig.Instance.CurrentProcess.ID;
            ProcessReadyComponent.Instance.SetReady(currentId);

            foreach(var process in StartConfig.Instance.Processes)
            {
                if(process.ID == currentId)
                {
                    continue;
                }

                var session = NetInnerComponent.Instance.Get(process.ID);
                session.Send(new SSProcessReadyNotify() { ProcessId = currentId });
            }
        }
    }
}
